<template>
    <Layout>
        <Form ref="form1" :model="form1" :label-width="120">
            <Row v-show="!switchFlag" class="query-form" style="padding-top: 10px">
                <!-- <Col span="8">
                     <FormItem label="评价等级：">
                         <Input type="text" v-model="form1.gradeLevel"></Input>
                     </FormItem>
                 </Col>-->
                <Col span="8">
                    <FormItem label="企业名称：">
                        <Input type="text" v-model="form1.contractorName"/>
                    </FormItem>
                </Col>
                <Col span="8">
                    <FormItem label="评价单位：">
                        <cascaderDom ref="childOrg" @setOrgInfo="setOrgId" @setOrgname="setOrgName"
                                     :rootOrgId="companyId"
                                     :orgTree="true"></cascaderDom>
                    </FormItem>
                </Col>
                <Col span="8">
                    <!--<Button @click="switchQuery(true)" class="ivu-btn-switch" type="text">展开∨</Button>-->
                    <Button @click="reset" class="ivu-btn-reset">重置</Button>
                    <Button class="ivu-btn-query" icon="md-search" @click="query()">查询</Button>
                </Col>
            </Row>
            <Row v-show="switchFlag" class="query-form" style="padding-top: 10px">
                <Col span="8">
                    <FormItem label="评价等级：">
                        <Input type="text" v-model="form1.gradeLevel"></Input>
                    </FormItem>
                </Col>
                <Col span="8">
                    <FormItem label="企业名称：">
                        <Input type="text" v-model="form1.contractorName"/>
                    </FormItem>
                </Col>
                <Col span="8">
                    <FormItem label="所属单位：">
                        <!--<cascaderDom ref="childOrg" @setOrgInfo="setOrgId" @setOrgname="setOrgName"
                                     :orgTree="true"></cascaderDom>-->
                    </FormItem>
                </Col>
            </Row>
            <Row v-show="switchFlag" class="query-form">
                <Col span="8" offset="16">
                    <Button @click="switchQuery(false)" class="ivu-btn-switch" type="text">收起∧</Button>
                    <Button @click="reset" class="ivu-btn-reset">重置</Button>
                    <Button class="ivu-btn-query" icon="md-search" @click="query()">查询</Button>
                </Col>
            </Row>
            <Row class="query-form">
                <Col span="24">
                    <Button size="large" class="ivu-btn-add" icon="md-add" @click="addInfo">新增</Button>
                </Col>
            </Row>
        </Form>
        <Table ref='table' :height="tableHeight" size="small" :loading="loading" class="table" no-data-text="没有查询到相关数据!"
               highlight-row stripe border :columns="columns1" width="100%" :data="dataTable">
        </Table>
        <Row style="margin-right:10px;">
            <Col span="24">
                <Page :total="pagedata.total" :page-size="pagedata.pageSize" @on-change="pageChange"
                      style="float: right" @on-page-size-change="pageSizeChange" :page-size-opts="pageSizeArray"
                      show-total show-sizer show-elevator/>
            </Col>
        </Row>

        <Modal :transfer=false v-model="model1" :width=600 title="新增待评价企业"
               @on-cancel="onCancel">
            <div>
                <Form ref='InputData' :model="InputData" :rules="ruleCustom" label-position="top">
                    <Row style="line-height: 42px;">
                        <Col span='20' style="margin-left: 30px;margin-bottom: 20px">
                            <FormItem label='企业名称：' prop="contractorName">
                                <Input readonly v-model="InputData.contractorName" readonly
                                       @on-focus="selectContractor"/>
                                <!--<Button slot="append" @click="selectContractor" icon="ios-search"></Button>-->
                                <!--</Input>-->
                            </FormItem>
                        </Col>
                        <!--<Col span='11' offset="1">
                            <FormItem label='评价等级：' prop="gradeLevel">
                                <Input v-model="InputData.gradeLevel"/>
                            </FormItem>
                        </Col>
                        <Col span='11' offset="">
                            <FormItem label='评价等级：' prop="grossScore">
                                <Input v-model="InputData.grossScore"/>
                            </FormItem>
                        </Col>-->
                    </Row>
                    <!-- <Row type="flex" justify="space-around" class="code-row-bg">
                         <Col span="23">
                             <FormItem>
                                 <Button class='ivu-btn-save' :loading="buttonLoading" @click="submit('InputData')">确定</Button>
                                 <Button class='ivu-btn-cancel' @click="onCancel">取消</Button>
                             </FormItem>
                         </Col>
                     </Row>-->
                </Form>
            </div>
            <div slot="footer">
                <Button class='ivu-btn-save' :loading="buttonLoading" @click="submit('InputData')">确定</Button>
                <Button class='ivu-btn-cancel' @click="onCancel">取消</Button>
            </div>
        </Modal>

        <Modal v-model="model2" footer-hide :width=800 title="相关方台账">
            <Form ref="pageModel2" :model="pageModel2" :label-width="120">
                <Row class="query-form">
                    <Col span="8">
                        <FormItem label="企业名称：">
                            <Input type="text" v-model="pageModel2.contractorName"/>
                        </FormItem>
                    </Col>
                    <Col span="8">
                        <Button @click="reset" class="ivu-btn-reset">重置</Button>
                        <Button class="ivu-btn-query" icon="md-search" @click="selectContractor()">查询</Button>
                    </Col>
                </Row>
                <Row>
                    <Col span="24">
                        <Table height="300" :loading="loading" size="small" class="table" no-data-text="没有查询到相关数据!"
                               @on-row-dblclick="danxuan"
                               highlight-row stripe border :columns="columns2" width="100%" :data="contractor">
                        </Table>
                    </Col>
                </Row>
                <Row style="margin-right:10px;">
                    <Col span="24">
                        <Page :total="pageModel2.total" :page-size="pageModel2.pageSize" @on-change="pageChange1"
                              style="float: right" @on-page-size-change="pageSizeChange1"
                              :page-size-opts="pageSizeArray"
                              show-total show-sizer show-elevator/>
                    </Col>
                </Row>
            </Form>
            <div slot="footer">
                <!--<Button type="text" @click="model2=false,buttonLoading=false">取消</Button>-->
                <!--<Button type="error" :disabled="buttonLoading" @click="baocun">确定</Button>-->
            </div>
        </Modal>


        <Modal v-model="model3" :width=800 title="日常评价列表" :mask-closable="false">
            <Form :label-width="120">
                <Row class="query-form">
                    <!-- <Col span="8">
                         <FormItem label="企业名称：">
                             <Input type="text" v-model="pageModel2.contractorName"/>
                         </FormItem>
                     </Col>-->
                    <!--<Col span="8">
                        <Button @click="reset" class="ivu-btn-reset">重置</Button>
                        <Button class="ivu-btn-query" icon="md-search" @click="selectContractor()">查询</Button>
                    </Col>-->
                    <Col span="8" style="margin-left: 20px">
                        <Button class="ivu-btn-add" icon="md-add" @click="addItemInfo()">添加评价</Button>
                    </Col>
                    <Col span="24" style="margin-left: 20px;margin-top: 10px;margin-bottom: 10px">
                        {{InputData.contractorName}}评价记录
                    </Col>
                </Row>
                <Row>
                    <Col span="24">
                        <Table height="300" :loading="loading" size="small" class="table" no-data-text="没有查询到相关数据!"
                               highlight-row stripe border :columns="columns3" width="100%" :data="evaluateItem">
                        </Table>
                    </Col>
                </Row>
                <Row style="margin-right:10px;">
                    <Col span="24">
                        <Page :total="detailItem.total" :page-size="detailItem.pageSize" @on-change="pageChange2"
                              style="float: right" @on-page-size-change="pageSizeChange2"
                              :page-size-opts="pageSizeArray"
                              show-total show-sizer show-elevator/>
                    </Col>
                </Row>
                <!-- <Row type="flex" justify="space-around" class="code-row-bg">
                     <Col span="23">
                         <FormItem>
                             <Button class='ivu-btn-save' @click="onCancel">确定</Button>
                             <Button class='ivu-btn-cancel' @click="onCancel">取消</Button>
                         </FormItem>
                     </Col>
                 </Row>-->
            </Form>
            <div slot="footer">
                <Button class='ivu-btn-save' @click="onCancel">确定</Button>
                <Button class='ivu-btn-cancel' @click="onCancel">取消</Button>
            </div>
        </Modal>

        <Modal :transfer=false v-model="model4" :width=700 :title="add?'日常评价新增':'日常评价修改'"
               @on-cancel="model4=false;InputItemData={}">
            <div>
                <Form ref='InputItemData' :model="InputItemData" :rules="ruleCustom1" label-position="top">
                    <Row style="line-height: 42px;">
                        <Col span='11'>
                            <FormItem label='扣分值：' prop="evalDailyScore">
                                <InputNumber style="width: 100%" :min="0" v-model="InputItemData.evalDailyScore"/>
                            </FormItem>
                        </Col>
                        <Col span='11' offset="1">
                            <FormItem label='评价时间：' prop="evalDate">
                                <Date-picker disabled type="date" style="width: 100%" v-model="InputItemData.evalDate"/>
                            </FormItem>
                        </Col>
                        <Col span='23'>
                            <FormItem label='扣分原因：' prop="evalDailyReason">
                                <Input v-model="InputItemData.evalDailyReason" type="textarea"
                                       :autosize="{minRows:2,maxRows:5}"/>
                            </FormItem>
                        </Col>

                        <Col span='23'>
                            <FormItem label='评价内容：' prop="notes">
                                <Input v-model="InputItemData.notes" type="textarea" :autosize="{minRows:2,maxRows:5}"/>
                            </FormItem>
                        </Col>
                    </Row>
                    <!-- <Row type="flex" justify="space-around" class="code-row-bg">
                         <Col span="23">
                             <FormItem>
                                 <Button class='ivu-btn-save' :disabled="buttonLoading" @click="submitItem('InputItemData')">确定</Button>
                                 <Button class='ivu-btn-cancel' @click="model4=false;InputItemData={}">取消</Button>
                             </FormItem>
                         </Col>
                     </Row>-->
                </Form>
            </div>
            <div slot="footer">
                <Button class='ivu-btn-save' :loading="buttonLoading" @click="submitItem('InputItemData')">确定</Button>
                <Button class='ivu-btn-cancel' @click="model4=false;InputItemData={}">取消</Button>
            </div>
        </Modal>


        <Modal :transfer=false v-model="model5" :width=600 title="日常评价详情"
               @on-cancel="model5=false">
            <Form class="modal-view-detail" :model="InputItemData" label-position="top">
                <Row style="line-height: 42px;">
                    <Col span='11'>
                        <span>扣分值：{{InputItemData.evalDailyScore}}</span>
                    </Col>
                    <Col span='11' offset="1">
                        <span>评价时间：{{evalDate}}</span>
                    </Col>
                </Row>
                <Row class="detail-background-clor" style="line-height: 42px;">
                    <Col span='23'>
                        <span>扣分原因：{{InputItemData.evalDailyReason}}</span>
                    </Col>
                </Row>
                <Row style="line-height: 42px;">
                    <Col span='23'>
                        <span>评价内容：{{InputItemData.notes}}</span>
                    </Col>
                </Row>
                <!-- <Row>
                     <Col span="23">
                         <FormItem>
                             <Button class='ivu-btn-save' @click="model5=false">关闭</Button>
                         </FormItem>
                     </Col>
                 </Row>-->
            </Form>
            <div slot="footer">
                <Button class='ivu-btn-save' @click="model5=false">关闭</Button>
            </div>
        </Modal>

    </Layout>
</template>

<script>
    import {Api} from '../../../api/index.js'
    import {sessionStorage} from '../../../common/cacheUtils.js';
    import cascaderDom from '../../../components/cascader-dom.vue';

    export default {
        components: {cascaderDom},
        name: "interestedPartiesEvaluate",
        data() {
            return {
                switchFlag: false,
                tableHeight: '',
                loading: false,
                form1: {
                    gradeLevel: '',
                    contractorName: '',
                    orgId: '',
                    orgName: ''
                },
                pageSizeArray: [10, 20, 50],
                pagedata: {
                    total: 0,
                    pageSize: 10,
                    currentPage: 1,
                },
                dataTable: [],
                ruleCustom: {
                    gradeLevel: [{
                        message: '  ',
                        required: true,
                        trigger: 'blue'
                    }],
                    contractorName: [{
                        message: '  ',
                        required: true,
                        trigger: 'change'
                    }],
                },
                ruleCustom1: {
                    evalDailyScore: [ { pattern: /^([0-9][0-9]*)+(.[0-9]{1,4})?$/, required: true, message: ' ', trigger: 'change',type:'number'}],
                    evalDate: [{
                        validator: (rule, value, callback) => {
                            if (value == null || value == '' || value == undefined) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                    notes: [{
                        validator: (rule, value, callback) => {
                            if (value == null || value == '' || value == undefined) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                    evalDailyReason: [{
                        validator: (rule, value, callback) => {
                            if (value == null || value == '' || value == undefined) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                },
                columns1: [
                    {
                        title: "序号",
                        width: 80,
                        align: "center",
                        fixed: 'left',
                        render: (h, params) => {
                            return h('span', params.index + (this.pagedata.currentPage - 1) * this.pagedata.pageSize + 1);
                        }
                    },
                    {
                        minWidth: 150,
                        title: '企业名称',
                        align: 'center',
                        key: 'contractorName',
                    },
                    // {
                    //     width: 200,
                    //     minWidth: 150,
                    //     title: '所属单位',
                    //     align: 'center',
                    //     key: 'companyName',
                    // },
                    {
                        minWidth: 150,
                        title: '评价单位',
                        align: 'center',
                        key: 'companyName',
                    },

                    {
                        title: '操作',
                        key: 'action',
                        fixed: 'right',
                        width: 140,
                        align: 'center',
                        render: (h, params) => {
                            return h('div', [
                                h('A', {
                                    props: {
                                        type: 'primary',
                                        size: 'small'
                                    },
                                    style: {
                                        fontSize: '14px',
                                    },
                                    on: {
                                        click: () => {
                                            this.InputData = params.row
                                            this.queryItem(params.row.evalDailyId)
                                        }
                                    }
                                }, '评价'),
                            ]);
                        }
                    }
                ],
                add: false,
                InputData: {},
                buttonLoading: false,
                banStart: '',
                banEnd: '',
                pageModel2: {
                    total: 0,
                    pageSize: 10,
                    currentPage: 1,
                    contractorName: ''
                },
                contractor: [],
                columns2: [
                    {
                        title: "序号",
                        width: 80,
                        align: "center",
                        fixed: 'left',
                        render: (h, params) => {
                            return h('span', params.index + (this.pageModel2.currentPage - 1) * this.pageModel2.pageSize + 1);
                        }
                    },
                    {
                        minWidth: 150,
                        title: '企业名称',
                        align: 'center',
                        key: 'contractorName',
                    },
                    {
                        minWidth: 150,
                        title: '企业性质',
                        align: 'center',
                        key: 'propertyName',
                    },
                    {
                        minWidth: 150,
                        title: '法定代表人',
                        align: 'center',
                        key: 'legalPerson',
                    },
                    {
                        minWidth: 150,
                        title: '注册资本',
                        align: 'center',
                        key: 'capital',
                    },
                    {
                        minWidth: 150,
                        title: '统一社会信用代码',
                        align: 'center',
                        key: 'unifyCode',
                    },
                ],
                model2: false,
                model1: false,

                columns3: [
                    {
                        type: 'index',
                        title: '序号',
                        width: 80,
                        align: 'center',
                    },
                    {
                        minWidth: 100,
                        title: '扣分值',
                        align: 'center',
                        key: 'evalDailyScore',
                    },
                    {
                        minWidth: 100,
                        title: '评价人',
                        align: 'center',
                        key: 'userName',
                    },
                    {
                        minWidth: 120,
                        title: '评价时间',
                        align: 'center',
                        key: 'evalDate',
                        render: (h, params) => {
                            let evalDate = new Date(params.row.evalDate);
                            return h('span', evalDate.getFullYear() + '-' + (evalDate.getMonth() + 1) + '-' + evalDate.getDate())
                        }
                    },
                    {
                        minWidth: 150,
                        title: '扣分原因',
                        align: 'center',
                        key: 'evalDailyReason',
                    },
                    {
                        minWidth: 150,
                        title: '评价内容',
                        align: 'center',
                        key: 'notes',
                    },
                    {
                        title: '操作',
                        key: 'action',
                        fixed: 'right',
                        width: 200,
                        align: 'center',
                        render: (h, params) => {
                            return h('div', [
                                h('A', {
                                    props: {
                                        type: 'primary',
                                        size: 'small'
                                    },
                                    style: {
                                        fontSize: '14px',
                                    },
                                    on: {
                                        click: () => {
                                            let evalDate = new Date(params.row.evalDate);
                                            this.evalDate = evalDate.getFullYear() + '-' + (evalDate.getMonth() + 1) + '-' + evalDate.getDate()
                                            this.InputItemData = params.row;
                                            this.model5 = true;
                                        }
                                    }
                                }, '详情'),
                                h('Divider', {
                                    props: {
                                        type: 'vertical',
                                    }
                                }, ''),
                                h('A', {
                                    props: {
                                        type: 'primary',
                                        size: 'small'
                                    },
                                    style: {
                                        fontSize: '14px',
                                        color: (params.row.createUserId == sessionStorage('userId').getObject('userId').userId ||  this.Common.userIdList.includes(sessionStorage('userId').getObject('userId').userId )||sessionStorage('userId').getObject('userId').userRole.find(obj => obj.roleId == '73b38b37dff64392ba0ee7dd579bf293') != undefined
                                            ||sessionStorage('userId').getObject('userId').userBeHandedOver.find(obj => obj == params.row.createUserId) != undefined)? '':'#d0d0d0' ,
                                        pointerEvents: (params.row.createUserId == sessionStorage('userId').getObject('userId').userId ||  this.Common.userIdList.includes(sessionStorage('userId').getObject('userId').userId )||sessionStorage('userId').getObject('userId').userRole.find(obj => obj.roleId == '73b38b37dff64392ba0ee7dd579bf293') != undefined
                                            ||sessionStorage('userId').getObject('userId').userBeHandedOver.find(obj => obj == params.row.createUserId) != undefined)? '' : 'none'
                                    },
                                    on: {
                                        click: () => {
                                            this.InputItemData = params.row;
                                            this.model4 = true;
                                            this.add = false
                                        }
                                    }
                                }, '修改'),
                                h('Divider', {
                                    props: {
                                        type: 'vertical',
                                    }
                                }, ''),
                                h('A', {
                                    props: {
                                        type: 'error',
                                        size: 'small'
                                    },
                                    style: {
                                        fontSize: '14px',
                                        color: (params.row.createUserId == sessionStorage('userId').getObject('userId').userId ||  this.Common.userIdList.includes(sessionStorage('userId').getObject('userId').userId )||sessionStorage('userId').getObject('userId').userRole.find(obj => obj.roleId == '73b38b37dff64392ba0ee7dd579bf293') != undefined
                                            ||sessionStorage('userId').getObject('userId').userBeHandedOver.find(obj => obj == params.row.createUserId) != undefined)? 'red':'#d0d0d0' ,
                                        pointerEvents: (params.row.createUserId == sessionStorage('userId').getObject('userId').userId ||  this.Common.userIdList.includes(sessionStorage('userId').getObject('userId').userId )||sessionStorage('userId').getObject('userId').userRole.find(obj => obj.roleId == '73b38b37dff64392ba0ee7dd579bf293') != undefined
                                            ||sessionStorage('userId').getObject('userId').userBeHandedOver.find(obj => obj == params.row.createUserId) != undefined) ? '' : 'none'
                                    },
                                    on: {
                                        click: () => {
                                            this.deleteItem(params.row);
                                        }
                                    }
                                }, '删除')
                            ]);
                        }
                    }
                ],
                evaluateItem: [],
                detailItem: {
                    total: 0,
                    pageSize: 10,
                    currentPage: 1,
                    contractorName: ''
                },
                evalDate: '',
                model3: false,

                InputItemData: {},
                model4: false,
                model5: false,
                companyId: '',
            }
        },
        mounted() {
            this.companyId = sessionStorage('userId').getObject('userId').companyId
            this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 145;
            this.query()
        },
        methods: {
            switchQuery(flag) {
                this.switchFlag = flag;
                if (!this.switchFlag) {
                    this.tableHeight = this.tableHeight + 44;
                } else {
                    this.tableHeight = this.tableHeight - 44;
                }
            },
            setOrgId(data) {
                this.form1.orgId = data[data.length - 1];
            },
            setOrgName(data) {
                this.form1.orgName = data;
            },
            danxuan(row, index) {
                this.InputData.contractorId = row.contractorId
                this.InputData.contractorName = row.contractorName
                this.model2 = false
                this.model1 = true
            },
            selectContractor() {
                this.loading = true;
                this.model2 = true
                this.contractor = []
                let data = {
                    startPage: this.pageModel2.currentPage,
                    size: this.pageModel2.pageSize,
                    contractorName: this.pageModel2.contractorName,
                    start: '1',
                    orgId:sessionStorage('userId').getObject('userId').companyId
                }
                data = Object.assign(data);
                let url = Api.interestedPartiesEvaluateBookList
                this.$http.get(url, {params: data}).then((res) => {
                    console.log(res.data);
                    this.contractor = res.data.data.data;
                    this.pageModel2.total = res.data.data.totalSize;
                    this.loading = false;
                }).catch(e => {
                    this.$Message.error("数据获取失败")
                })
            },

            onCancel() {
                this.InputData = {}
                this.InputItemData = {}
                this.model1 = false
                this.model3 = false
                this.model4 = false
                this.query()
            },
            submitItem(name) {
                this.$refs[name].validate((valid) => {
                    if (valid) {
                        this.buttonLoading = true
                        if (this.add) {
                            let url = Api.interestedPartiesEvaluateItemAdd
                            this.InputItemData.bsflag = '0'
                            this.InputItemData.createOrgId = sessionStorage('userId').getObject('userId').orgInfo.orgId
                            this.InputItemData.createUserId = sessionStorage('userId').getObject('userId').userId
                            this.$http.post(url, this.InputItemData).then((res) => {
                                this.$Message.success('成功');
                                this.queryItem(this.InputItemData.evalDailyId);
                                this.buttonLoading = false
                                this.model4 = false
                            }).catch(e => {
                                this.$Message.error('请求失败');
                            })
                        } else {
                            let url = Api.interestedPartiesEvaluateItemUpdate;
                            this.InputItemData.updateUserId = sessionStorage('userId').getObject('userId').userId
                            this.InputItemData.updateOrgId = sessionStorage('userId').getObject('userId').orgInfo.orgId
                            this.$http.post(url, this.InputItemData).then((res) => {
                                this.$Message.success('成功');
                                this.buttonLoading = false
                                this.model4 = false
                                this.queryItem(this.InputItemData.evalDailyId);
                            }).catch(e => {
                                this.$Message.error('请求失败');
                            })
                        }
                    } else {
                        this.$Message.error('失败!');
                    }
                })
            },

            queryItem(id) {
                this.loading = true;
                this.model3 = true
                let data = {
                    starPage: this.detailItem.currentPage,
                    size: this.detailItem.pageSize,
                    dailyItemId: id
                }
                let url = Api.interestedPartiesEvaluateItemList
                this.$http.get(url, {params: data}).then((res) => {
                    console.log(res.data);
                    this.evaluateItem = res.data.data.data;
                    this.detailItem.total = res.data.data.totalSize;
                    this.loading = false;
                }).catch(e => {
                    this.$Message.error("数据获取失败")
                })
            },

            deleteItem(row) {
                this.$Modal.confirm({
                    title: '提示',
                    content: '<p>确认删除此行数据？</p>',
                    onOk: () => {
                        let url = Api.interestedPartiesEvaluateItemDelete + '/' + row.evalDailyItemId
                        this.$http.delete(url).then((res) => {
                            this.$Message.success('成功');
                            this.queryItem(this.InputData.evalDailyId);
                        }).catch(e => {
                            this.$Message.error("数据获取失败")
                        })
                    },
                    onCancel: () => {
                    }
                });
            },

            addItemInfo() {
                this.add = true;
                this.InputItemData = {
                    evalDailyId: this.InputData.evalDailyId,
                    evalDailyScore: 1,
                    evalDate: new Date()
                };
                this.model4 = true;
            },

            submit(name) {
                this.$refs[name].validate((valid) => {
                    if (valid) {
                        this.buttonLoading = true
                        let url = Api.interestedPartiesEvaluateAdd
                        this.InputData.bsflag = '0'
                        this.InputData.createOrgId = sessionStorage('userId').getObject('userId').orgInfo.orgId
                        this.InputData.createUserId = sessionStorage('userId').getObject('userId').userId
                        this.$http.post(url, this.InputData).then((res) => {
                            this.$Message.success('成功');
                            this.query()
                            this.buttonLoading = false
                            this.model1 = false
                        }).catch(e => {
                            this.$Message.error('请求失败');
                        })
                    } else {
                        this.$Message.error('失败!');
                    }
                })
            },
            addInfo() {
                this.InputData = {};
                this.model1 = true;
            },
            query() {
                this.loading = true;
                let data = {
                    starPage: this.pagedata.currentPage,
                    size: this.pagedata.pageSize
                }
                if (this.form1.orgId == '') {
                    this.form1.orgId = this.companyId
                }
                data = Object.assign(data, JSON.parse(JSON.stringify(this.form1)));
                let url = Api.interestedPartiesEvaluateList
                this.$http.get(url, {params: data}).then((res) => {
                    console.log(res.data);
                    this.dataTable = res.data.data.data;
                    this.pagedata.total = res.data.data.totalSize;
                    this.loading = false;
                }).catch(e => {
                    this.$Message.error("数据获取失败")
                })
            },
            reset() {
                this.form1 = {
                    gradeLevel: '',
                    contractorName: '',
                    orgId: '',
                    orgName: ''
                }
                this.pageModel2.currentPage = 1;
                this.pageModel2.contractorName = ''

                this.$refs.childOrg.resetCurrentOrg();
                this.query();
            },
            pageChange2(pageNum) {
                this.detailItem.currentPage = pageNum;
                this.queryItem(this.InputData.evalDailyId);
            },
            pageSizeChange2(pageSize) {
                this.detailItem.pageSize = pageSize;
                this.queryItem(this.InputData.evalDailyId);
            },
            pageChange1(pageNum) {
                this.pageModel2.currentPage = pageNum;
                this.selectContractor();
            },
            pageSizeChange1(pageSize) {
                this.pageModel2.pageSize = pageSize;
                this.selectContractor();
            },
            pageChange(pageNum) {
                this.pagedata.currentPage = pageNum;
                this.query();
            },
            pageSizeChange(pageSize) {
                this.pagedata.pageSize = pageSize;
                this.query();
            },
        }
    }
</script>

<style scoped>
    @import '../../../index.css';

</style>